Skip to content

fix!: support Microsoft.OData.Edm 9 and drop .NET versions below 10 - #940

Merged
Gavin Barron (gavinbarron) merged 6 commits into
mainfrom
fix/odata-edm-9
Nov 12, 2026
Merged

Gavin Barron (gavinbarron) merged 6 commits into
mainfrom
fix/odata-edm-9

Conversation

@baywet

@baywet Vincent Biret (baywet) commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Fixes #937. Related: #833.

⚠️ Breaking change

The reader (Microsoft.OpenApi.OData), Hidi and the tooling projects now target .NET 10 only (.NET 8 is out of support) and depend on Microsoft.OData.Edm 9.x. Consumers on earlier runtimes or Edm 8.x need to stay on the previous major version.

Problem

Microsoft.OData.Edm 9.0.0 removed ExtensionMethods.GetReturn(IEdmOperation) and replaced Date/TimeOfDay with DateOnly/TimeOnly. It also supports only .NET 10. The published reader is compiled against Edm 8.x, so on Edm 9 conversion fails with MissingMethodException.

Changes

  • Targets: the reader, its tests, Hidi, OoasUtil and OoasGui now target net10.0 (net10.0-windows for OoasGui) and reference Edm 9.0.0. There is no multi-targeting or conditional compilation.
  • GetReturn() → IEdmOperation.ReturnType at every call site.
  • Dates/times:
    • Revision dates convert Edm 9 DateOnly to DateTime.
    • ODataPrimitiveValue.ToString() formats DateOnly/TimeOnly as invariant OData literals (yyyy-MM-dd, HH:mm:ss.fffffff) instead of culture-dependent strings like 3:38 PM.
  • Hidi:
    • Removed its direct Edm 8.4.4 reference; Edm now comes from the reader.
    • Fixed the .NET 10 analyzer findings that AnalysisMode=All treats as errors:
      • CA1873: guard expensive log arguments with IsEnabled.
      • CA1874: Regex.IsMatch.
      • CA1515: make Logger and OpenApiSpecVersionHelper internal.
  • CI/release:
    • Removed the .NET 8 SDK installs from the GitHub workflows and Azure pipelines.
    • Updated the net8.0 output/package paths in the pipelines and scripts.
    • Pointed Sonar at coverage.opencover.xml; with a single target framework, coverlet no longer adds the TFM suffix to the report name.
    • Moved the Hidi Docker runtime image to runtime:10.0-noble-chiseled.
  • Tests:
    • Replaced the Moq IEdmModel proxy in the annotation-cache tests with a counting EdmModel subclass, because Castle cannot proxy Edm 9's ReadOnlySpan<char> members.
    • Declared the id key property in five ODataPathProviderTests models that referenced an undeclared key (Edm 9 returns null there).
    • Used the CsdlWriter.TryWriteCsdl overload without CsdlTarget.
  • Docs: the README files state the .NET 10 / Edm 9 requirements.

dotnet format also normalized existing whitespace in the touched files; use Hide whitespace to review the substantive diff.

Validation

  • Solution build: succeeded. OoasGui and OoasUtil also build.
  • Reader tests: 1286/1286 on net10.0.
  • Hidi tests: 107/107.
  • End-to-end: with a locally packed reader, the Kiota sample API on .NET 11 (Microsoft.OData.Core 9.0.0, Microsoft.AspNetCore.OData 10.0.0-preview.2) generates /openapi/openapi.yaml, and all 11 sample tests pass. That sample migration is blocked on this fix: chore: migrate sample API and .NET client to .NET 11 (blocked by OData 9) kiota-samples#9364.

Multi-target the reader for net8.0 (Microsoft.OData.Edm 8.4.4) and net10.0 (Microsoft.OData.Edm 9.0.0), since Edm 9 only supports .NET 10 and is binary incompatible with 8.x.

- Replace the removed GetReturn() extension with IEdmOperation.ReturnType, available in both Edm versions.
- Convert Edm 9 DateOnly values for revision dates and format DateOnly/TimeOnly example values as invariant OData literals.
- Let Hidi take Edm from the reader so .NET 10 consumers do not get a package downgrade.
- Run the reader tests on net8.0 and net10.0. Replace the IEdmModel Moq proxy, which cannot implement Edm 9 ReadOnlySpan members, and declare key properties in invalid test models.

Fixes #937

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 26ff6e74-45c7-4932-bfa8-11c1c74d16e1
Vincent Biret (baywet) added a commit to microsoft/kiota-samples that referenced this pull request Nov 11, 2026
The OpenAPI YAML writer quotes the version (openapi: '3.1.2'). Verified against microsoft/OpenAPI.NET.OData#940.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 26ff6e74-45c7-4932-bfa8-11c1c74d16e1
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 26ff6e74-45c7-4932-bfa8-11c1c74d16e1
Target net10.0 only and depend solely on Microsoft.OData.Edm 9, removing
the net8.0 multi-targeting and conditional compilation. .NET 8 is out of
support for this release line.

BREAKING CHANGE: Microsoft.OpenApi.OData and Hidi now target .NET 10 only and
require Microsoft.OData.Edm 9.x. Consumers on earlier runtimes or Edm 8.x
must stay on the previous major version.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 26ff6e74-45c7-4932-bfa8-11c1c74d16e1
@baywet Vincent Biret (baywet) changed the title fix: support Microsoft.OData.Edm 9 on .NET 10 fix!: support Microsoft.OData.Edm 9 and drop .NET versions below 10 Nov 11, 2026
- Install only the .NET 10 SDK in the GitHub workflows.
- Point Sonar at coverage.opencover.xml: with a single target framework,
  coverlet no longer suffixes the report with the TFM, so the previous
  coverage.net*.opencover.xml glob matched nothing.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 26ff6e74-45c7-4932-bfa8-11c1c74d16e1
- Remove the unused obsolete ODataConstants.OdataCount field
  (superseded by CreateOdataCount).
- Remove the CreateOrderBy/CreateSelect/CreateExpand overloads taking
  IEdmEntityType that only forwarded to the IEdmStructuredType overloads,
  and move their documentation to those overloads.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 26ff6e74-45c7-4932-bfa8-11c1c74d16e1
The EsrpCodeSigning tasks were upgraded and no longer need the .NET 6
runtime, so drop the UseDotNet 6.x steps from the Azure pipelines.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 26ff6e74-45c7-4932-bfa8-11c1c74d16e1
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
79.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@gavinbarron
Gavin Barron (gavinbarron) marked this pull request as ready for review November 12, 2026 21:38
@gavinbarron
Gavin Barron (gavinbarron) requested a review from a team as a code owner November 12, 2026 21:38
@gavinbarron

Copy link
Copy Markdown
Contributor

Thanks for your work here Vincent Biret (@baywet)

I'm of the opinion that we ship this as v4.0.0 and deprecate v3.x

I'll work on getting this reviewed here.

@gavinbarron
Gavin Barron (gavinbarron) merged commit 2124246 into main Nov 12, 2026
42 of 45 checks passed
@gavinbarron
Gavin Barron (gavinbarron) deleted the fix/odata-edm-9 branch November 12, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stable OData EDM 9.0.0 still breaks OpenAPI conversion with MissingMethodException (GetReturn)

2 participants